package top.jiangqiang.qyblog.core.domain;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import top.jiangqiang.qyblog.core.validate.Allow;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author Jiangqiang
 * @version 1.0
 * @date 2022/12/7 9:58
 */
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@Data
@Schema(name = "存储器属性配置", description = "")
public class StorageProperties implements Serializable {
    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "region", example = "ap-beijing", defaultValue = "Auto")
    private String region = "Auto";

    @Schema(description = "上传时endpoint所使用的协议，会拼接在endpoint的前面", defaultValue = "https")
    @Allow(allowValues = {"https", "http"}, message = "endpoint协议不合法")
    private String endpointProtocol = "https";
    @Schema(description = "文件最终访问链接使用的协议", defaultValue = "https")
    @Allow(allowValues = {"https", "http"}, message = "访问协议不合法")
    private String accessProtocol = "https";
    @Schema(description = "accessKey", example = "LTAI5tQEFJNuUjDX9D1A21Ac")
    @NotBlank(message = "keyId不能为空")
    private String accessKey;
    @Schema(description = "accessSecret", example = "JtjQ2wnDSKjzuzdRdLBf6zDy5DjkA1")
    @NotBlank(message = "accessSecret不能为空")
    private String accessSecret;
    @Schema(description = "访问风格")
    @NotNull(message = "访问风格不能为空")
    private Boolean enablePathStyleAccess;

    @Schema(description = "域名")
    private String domain;
    @Schema(description = "bucket")
    private String bucket;
    @Schema(description = "endpoint，腾讯云参考：https://www.tencentcloud.com/zh/document/product/436/6224", example = "oss-cn-chengdu.aliyuncs.com")
    @NotBlank(message = "endpoint不能为空")
    private String endpoint;

    @Schema(description = "上传到指定文件夹内")
    private String dirName;
}
